﻿using OSS.Common.Encrypt;
using OSS.Common.Extention;
using Snowflake.Core;
using System;
using System.Security.Cryptography;
using System.Text;

namespace HRX.PayCenter.Console
{
    class Program
    {
        private static string publicKey = @"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxmpBVPyOZmJ14XzEYLCi2GExVNKzXPv4ELTVBJx8MT5fmQjdwREk77sCi1/4Czp+cYdlaj9KvEfw7LGEAnf1xkAi5Tiy06lJZmDhQMyV0L5PZOrj9PJUoJhcJs4hfz6d+AwkrMTeY5rvo+SYO27+4oq3tzWwKmmlfkQlh1QOZ/wwUBgi+e1Ax487Rz1oR0vUG4DWKhZ/bbX8CJx4N+w7WnwrWUWm74BcRB5KrGob/zaRFtCQoUSixtiOqtbACGyyJzPNg2WQm7TaM+2fpifBSbTmFT3z4M/YpplGSci8wIda/D/7NMeM11iUhzYZgLYB9dkcx7VLh1bh+WlsYNn2BwIDAQAB";
        private static string privateKey = @"MIIEowIBAAKCAQEAxmpBVPyOZmJ14XzEYLCi2GExVNKzXPv4ELTVBJx8MT5fmQjdwREk77sCi1/4Czp+cYdlaj9KvEfw7LGEAnf1xkAi5Tiy06lJZmDhQMyV0L5PZOrj9PJUoJhcJs4hfz6d+AwkrMTeY5rvo+SYO27+4oq3tzWwKmmlfkQlh1QOZ/wwUBgi+e1Ax487Rz1oR0vUG4DWKhZ/bbX8CJx4N+w7WnwrWUWm74BcRB5KrGob/zaRFtCQoUSixtiOqtbACGyyJzPNg2WQm7TaM+2fpifBSbTmFT3z4M/YpplGSci8wIda/D/7NMeM11iUhzYZgLYB9dkcx7VLh1bh+WlsYNn2BwIDAQABAoIBAG4MLvIxJdX5lEIdTloGfjufJJpURrEy+3JgqalmFafGXYVmmn/jv2XLhmzBLLUlm03id8hHFG97Q1A0YPBxknqDxhb2rJCi2xgScbzb+9gMRcLGWOrZoUB1YN8RAxktJLaYHZtJkcMTAwkW16xXMr15jM3r1Cqh7+0pZNs7LsZS6cwltGd4SpW1ALSacgoDteg3cJF8ZlSZN+GnB8Y45kibydJoGG2bfSOaCYUkkcIZdv+7yOk85ffZji0EGoKKubUb3Nu5Z2IrZAYI8v2YW5fVVTjy8X4OzPIbwIVVBXRwSWENi91tvlokmA/mnT8cOKjPlqoO/sH/hx71e7vkACECgYEA8xfohJY7pXbSsECh//IG95KwWEWc0JztzW2F/pLxns5SI4/cTnHhQM09VNyxRJqMpunfPD5FCBst0Aj06ZPgCGroJz4iEKv1ZqLcAfAbA+TiFqZ3u72+S/+WoaUgsN9rRGV4MRhYuJJ/1EZQtfketdqnAGO8UcvwIjyiP5KkMHcCgYEA0PMV0SG/L1WrXNlFcfqAsN6O+UpfDFSQSWea9HZxM8ZUmCKlEfAMCmRToXqvrBw70DxDK30iwOaebTL2bWDwyD8KrfimXcZUnggvOVUzh8obZLJSKhKLQ3/FEC385mTlpf4n2rYRbbusfD6RMM8g+rKoPnr2eDUSRPL/HlDV2vECgYB+IhimuyEF0OqvQ0oLeLR+vyE7HBuq7tJA9iRBnFM8mEdsZlfkaBh9vECniL9+Hkb+0HjhVFoTQ674s70IeY8ULwx4WDfquJ7je3t2kfQiiB97qzKTOnfEDUFGbFzTCYop+hBsQPrAAlvLdBSq5zE1INfoTtfHBW97BEUXgWoqLwKBgErZ2cXqFefqA5ImTydOeo1hnMwW5Uewf2OcVrkeON04PhOlzYZIfLe4SvE81vOLxa2J+PH6SNnbg4NQz1BNetPxKW069rX/F07pValvKR+KuhdvfdmOfQ74FWr/XmpWWKIHEtXZhRLPOTHk4/QdLw4/s992Axb6xAmpFtUQVhuxAoGBANLzZb7dhV+dWFRfIkP12chrGZ4ES13GUUK3T9I28uDteeFKdoaF7dJ5RRgmaHpZ0OUdgNYgkKsXVTR1aLyJ94Rs/wbpAKpzFGp7zvyVxDejAw/iZPUnEaPeDLblw7ElVtP02GjpZVAokjg+2YPBA4/IQ2thSbWoPAW6imV4O5V2";

        static void Main(string[] args)
        {
            var idWork = new IdWorker(1, 1);
            for (var i = 0; i < 100; i++)
            {
                var id = idWork.NextId().ToString();
                System.Console.WriteLine(id + "_" + id.Substring(14, 5));
            }




            //try
            //{

            string key = "MIIBIjANBgkqhk";
            string encrpty = "{\"jsonKey\":\"jsonVal\"}";

            var key1 = OSS.Common.Encrypt.Md5.EncryptHexString(key).ToLower();

            var result = AesRijndael.Encrypt(encrpty, key1).Base64UrlEncode();

            //    var result2 = AesRijndael.Decrypt(result.Base64UrlDecode(), key1);

            //    if (result2 == encrpty)
            //    {
            //        System.Console.WriteLine("Ok");
            //    }
            //}
            //catch (Exception ex)
            //{

            //    throw;
            //}


            System.Console.ReadLine();
        }
    }
}
